package jmars.mobile.common;

import java.io.IOException;
import java.util.Properties;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;

public class PropertiesLoader {
	private static Properties properties=null;
	private PropertiesLoader(){}
	
	private static synchronized void initProperties(){
		if(null==properties){
			Resource r=new ClassPathResource("init.properties");
			if(r!=null)
				try {
					properties = new Properties();
					properties.load(r.getInputStream());
				} catch (IOException e) {
					e.printStackTrace();
				}
		}
	}
	
	public static String getProperty(String key){
		initProperties();
		return properties.getProperty(key);
	}
}
